{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "code",
      "source": [
        "!pip install google-generativeai -q"
      ],
      "metadata": {
        "id": "TjD7Q3PiU_H3"
      },
      "execution_count": 3,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "import google.generativeai as genai\n",
        "import json\n",
        "import time\n",
        "import uuid\n",
        "from enum import Enum\n",
        "from typing import Dict, List, Any, Optional\n",
        "from dataclasses import dataclass, asdict\n",
        "\n",
        "GEMINI_API_KEY = \"Use Your Gemini API Key\"\n",
        "genai.configure(api_key=GEMINI_API_KEY)"
      ],
      "metadata": {
        "id": "Cgdrdrq6U-Ob"
      },
      "execution_count": 4,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "class ACPMessageType(Enum):\n",
        "    \"\"\"Standard ACP message types\"\"\"\n",
        "    REQUEST = \"request\"\n",
        "    RESPONSE = \"response\"\n",
        "    INFORM = \"inform\"\n",
        "    QUERY = \"query\"\n",
        "    SUBSCRIBE = \"subscribe\"\n",
        "    UNSUBSCRIBE = \"unsubscribe\"\n",
        "    ERROR = \"error\"\n",
        "    ACK = \"acknowledge\""
      ],
      "metadata": {
        "id": "coLfyuyvVCzO"
      },
      "execution_count": 5,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "class ACPPerformative(Enum):\n",
        "    \"\"\"ACP speech acts (performatives)\"\"\"\n",
        "    TELL = \"tell\"\n",
        "    ASK = \"ask\"\n",
        "    REPLY = \"reply\"\n",
        "    REQUEST_ACTION = \"request-action\"\n",
        "    AGREE = \"agree\"\n",
        "    REFUSE = \"refuse\"\n",
        "    PROPOSE = \"propose\"\n",
        "    ACCEPT = \"accept\"\n",
        "    REJECT = \"reject\""
      ],
      "metadata": {
        "id": "ZXHHJbusVDxO"
      },
      "execution_count": 6,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "@dataclass\n",
        "class ACPMessage:\n",
        "    \"\"\"Agent Communication Protocol Message Structure\"\"\"\n",
        "    message_id: str\n",
        "    sender: str\n",
        "    receiver: str\n",
        "    performative: str\n",
        "    content: Dict[str, Any]\n",
        "    protocol: str = \"ACP-1.0\"\n",
        "    conversation_id: str = None\n",
        "    reply_to: str = None\n",
        "    language: str = \"english\"\n",
        "    encoding: str = \"json\"\n",
        "    timestamp: float = None\n",
        "\n",
        "    def __post_init__(self):\n",
        "        if self.timestamp is None:\n",
        "            self.timestamp = time.time()\n",
        "        if self.conversation_id is None:\n",
        "            self.conversation_id = str(uuid.uuid4())\n",
        "\n",
        "    def to_acp_format(self) -> str:\n",
        "        \"\"\"Convert to standard ACP message format\"\"\"\n",
        "        acp_msg = {\n",
        "            \"message-id\": self.message_id,\n",
        "            \"sender\": self.sender,\n",
        "            \"receiver\": self.receiver,\n",
        "            \"performative\": self.performative,\n",
        "            \"content\": self.content,\n",
        "            \"protocol\": self.protocol,\n",
        "            \"conversation-id\": self.conversation_id,\n",
        "            \"reply-to\": self.reply_to,\n",
        "            \"language\": self.language,\n",
        "            \"encoding\": self.encoding,\n",
        "            \"timestamp\": self.timestamp\n",
        "        }\n",
        "        return json.dumps(acp_msg, indent=2)\n",
        "\n",
        "    @classmethod\n",
        "    def from_acp_format(cls, acp_string: str) -> 'ACPMessage':\n",
        "        \"\"\"Parse ACP message from string format\"\"\"\n",
        "        data = json.loads(acp_string)\n",
        "        return cls(\n",
        "            message_id=data[\"message-id\"],\n",
        "            sender=data[\"sender\"],\n",
        "            receiver=data[\"receiver\"],\n",
        "            performative=data[\"performative\"],\n",
        "            content=data[\"content\"],\n",
        "            protocol=data.get(\"protocol\", \"ACP-1.0\"),\n",
        "            conversation_id=data.get(\"conversation-id\"),\n",
        "            reply_to=data.get(\"reply-to\"),\n",
        "            language=data.get(\"language\", \"english\"),\n",
        "            encoding=data.get(\"encoding\", \"json\"),\n",
        "            timestamp=data.get(\"timestamp\", time.time())\n",
        "        )"
      ],
      "metadata": {
        "id": "U6CtP0S0VEPG"
      },
      "execution_count": 7,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "class ACPAgent:\n",
        "    \"\"\"Agent implementing Agent Communication Protocol\"\"\"\n",
        "\n",
        "    def __init__(self, agent_id: str, name: str, capabilities: List[str]):\n",
        "        self.agent_id = agent_id\n",
        "        self.name = name\n",
        "        self.capabilities = capabilities\n",
        "        self.model = genai.GenerativeModel(\"gemini-1.5-flash\")\n",
        "        self.message_queue: List[ACPMessage] = []\n",
        "        self.subscriptions: Dict[str, List[str]] = {}\n",
        "        self.conversations: Dict[str, List[ACPMessage]] = {}\n",
        "\n",
        "    def create_message(self, receiver: str, performative: str,\n",
        "                      content: Dict[str, Any], conversation_id: str = None,\n",
        "                      reply_to: str = None) -> ACPMessage:\n",
        "        \"\"\"Create a new ACP-compliant message\"\"\"\n",
        "        return ACPMessage(\n",
        "            message_id=str(uuid.uuid4()),\n",
        "            sender=self.agent_id,\n",
        "            receiver=receiver,\n",
        "            performative=performative,\n",
        "            content=content,\n",
        "            conversation_id=conversation_id,\n",
        "            reply_to=reply_to\n",
        "        )\n",
        "\n",
        "    def send_inform(self, receiver: str, fact: str, data: Any = None) -> ACPMessage:\n",
        "        \"\"\"Send an INFORM message (telling someone a fact)\"\"\"\n",
        "        content = {\"fact\": fact, \"data\": data}\n",
        "        return self.create_message(receiver, ACPPerformative.TELL.value, content)\n",
        "\n",
        "    def send_query(self, receiver: str, question: str, query_type: str = \"yes-no\") -> ACPMessage:\n",
        "        \"\"\"Send a QUERY message (asking for information)\"\"\"\n",
        "        content = {\"question\": question, \"query-type\": query_type}\n",
        "        return self.create_message(receiver, ACPPerformative.ASK.value, content)\n",
        "\n",
        "    def send_request(self, receiver: str, action: str, parameters: Dict = None) -> ACPMessage:\n",
        "        \"\"\"Send a REQUEST message (asking someone to perform an action)\"\"\"\n",
        "        content = {\"action\": action, \"parameters\": parameters or {}}\n",
        "        return self.create_message(receiver, ACPPerformative.REQUEST_ACTION.value, content)\n",
        "\n",
        "    def send_reply(self, original_msg: ACPMessage, response_data: Any) -> ACPMessage:\n",
        "        \"\"\"Send a REPLY message in response to another message\"\"\"\n",
        "        content = {\"response\": response_data, \"original-question\": original_msg.content}\n",
        "        return self.create_message(\n",
        "            original_msg.sender,\n",
        "            ACPPerformative.REPLY.value,\n",
        "            content,\n",
        "            conversation_id=original_msg.conversation_id,\n",
        "            reply_to=original_msg.message_id\n",
        "        )\n",
        "\n",
        "    def process_message(self, message: ACPMessage) -> Optional[ACPMessage]:\n",
        "        \"\"\"Process incoming ACP message and generate appropriate response\"\"\"\n",
        "        self.message_queue.append(message)\n",
        "\n",
        "        conv_id = message.conversation_id\n",
        "        if conv_id not in self.conversations:\n",
        "            self.conversations[conv_id] = []\n",
        "        self.conversations[conv_id].append(message)\n",
        "\n",
        "        if message.performative == ACPPerformative.ASK.value:\n",
        "            return self._handle_query(message)\n",
        "        elif message.performative == ACPPerformative.REQUEST_ACTION.value:\n",
        "            return self._handle_request(message)\n",
        "        elif message.performative == ACPPerformative.TELL.value:\n",
        "            return self._handle_inform(message)\n",
        "\n",
        "        return None\n",
        "\n",
        "    def _handle_query(self, message: ACPMessage) -> ACPMessage:\n",
        "        \"\"\"Handle incoming query messages\"\"\"\n",
        "        question = message.content.get(\"question\", \"\")\n",
        "\n",
        "        prompt = f\"As agent {self.name} with capabilities {self.capabilities}, answer: {question}\"\n",
        "        try:\n",
        "            response = self.model.generate_content(prompt)\n",
        "            answer = response.text.strip()\n",
        "        except:\n",
        "            answer = \"Unable to process query at this time\"\n",
        "\n",
        "        return self.send_reply(message, {\"answer\": answer, \"confidence\": 0.8})\n",
        "\n",
        "    def _handle_request(self, message: ACPMessage) -> ACPMessage:\n",
        "        \"\"\"Handle incoming action requests\"\"\"\n",
        "        action = message.content.get(\"action\", \"\")\n",
        "        parameters = message.content.get(\"parameters\", {})\n",
        "\n",
        "        if any(capability in action.lower() for capability in self.capabilities):\n",
        "            result = f\"Executing {action} with parameters {parameters}\"\n",
        "            status = \"agreed\"\n",
        "        else:\n",
        "            result = f\"Cannot perform {action} - not in my capabilities\"\n",
        "            status = \"refused\"\n",
        "\n",
        "        return self.send_reply(message, {\"status\": status, \"result\": result})\n",
        "\n",
        "    def _handle_inform(self, message: ACPMessage) -> Optional[ACPMessage]:\n",
        "        \"\"\"Handle incoming information messages\"\"\"\n",
        "        fact = message.content.get(\"fact\", \"\")\n",
        "        print(f\"[{self.name}] Received information: {fact}\")\n",
        "\n",
        "        ack_content = {\"status\": \"received\", \"fact\": fact}\n",
        "        return self.create_message(message.sender, \"acknowledge\", ack_content,\n",
        "                                 conversation_id=message.conversation_id)"
      ],
      "metadata": {
        "id": "uAdajLaSVHDn"
      },
      "execution_count": 8,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "class ACPMessageBroker:\n",
        "    \"\"\"Message broker implementing ACP routing and delivery\"\"\"\n",
        "\n",
        "    def __init__(self):\n",
        "        self.agents: Dict[str, ACPAgent] = {}\n",
        "        self.message_log: List[ACPMessage] = []\n",
        "        self.routing_table: Dict[str, str] = {}\n",
        "\n",
        "    def register_agent(self, agent: ACPAgent):\n",
        "        \"\"\"Register an agent with the message broker\"\"\"\n",
        "        self.agents[agent.agent_id] = agent\n",
        "        self.routing_table[agent.agent_id] = \"local\"\n",
        "        print(f\"✓ Registered agent: {agent.name} ({agent.agent_id})\")\n",
        "\n",
        "    def route_message(self, message: ACPMessage) -> bool:\n",
        "        \"\"\"Route ACP message to appropriate recipient\"\"\"\n",
        "        if message.receiver not in self.agents:\n",
        "            print(f\"✗ Receiver {message.receiver} not found\")\n",
        "            return False\n",
        "\n",
        "        print(f\"\\n📨 ACP MESSAGE ROUTING:\")\n",
        "        print(f\"From: {message.sender} → To: {message.receiver}\")\n",
        "        print(f\"Performative: {message.performative}\")\n",
        "        print(f\"Content: {json.dumps(message.content, indent=2)}\")\n",
        "\n",
        "        receiver_agent = self.agents[message.receiver]\n",
        "        response = receiver_agent.process_message(message)\n",
        "\n",
        "        self.message_log.append(message)\n",
        "\n",
        "        if response:\n",
        "            print(f\"\\n📤 GENERATED RESPONSE:\")\n",
        "            print(f\"From: {response.sender} → To: {response.receiver}\")\n",
        "            print(f\"Content: {json.dumps(response.content, indent=2)}\")\n",
        "\n",
        "            if response.receiver in self.agents:\n",
        "                self.agents[response.receiver].process_message(response)\n",
        "                self.message_log.append(response)\n",
        "\n",
        "        return True\n",
        "\n",
        "    def broadcast_message(self, message: ACPMessage, recipients: List[str]):\n",
        "        \"\"\"Broadcast message to multiple recipients\"\"\"\n",
        "        for recipient in recipients:\n",
        "            msg_copy = ACPMessage(\n",
        "                message_id=str(uuid.uuid4()),\n",
        "                sender=message.sender,\n",
        "                receiver=recipient,\n",
        "                performative=message.performative,\n",
        "                content=message.content.copy(),\n",
        "                conversation_id=message.conversation_id\n",
        "            )\n",
        "            self.route_message(msg_copy)"
      ],
      "metadata": {
        "id": "sIOjje02VNnf"
      },
      "execution_count": 9,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "def demonstrate_acp():\n",
        "    \"\"\"Comprehensive demonstration of Agent Communication Protocol\"\"\"\n",
        "\n",
        "    print(\"🤖 AGENT COMMUNICATION PROTOCOL (ACP) DEMONSTRATION\")\n",
        "    print(\"=\" * 60)\n",
        "\n",
        "    broker = ACPMessageBroker()\n",
        "\n",
        "    researcher = ACPAgent(\"agent-001\", \"Dr. Research\", [\"analysis\", \"research\", \"data-processing\"])\n",
        "    assistant = ACPAgent(\"agent-002\", \"AI Assistant\", [\"information\", \"scheduling\", \"communication\"])\n",
        "    calculator = ACPAgent(\"agent-003\", \"MathBot\", [\"calculation\", \"mathematics\", \"computation\"])\n",
        "\n",
        "    broker.register_agent(researcher)\n",
        "    broker.register_agent(assistant)\n",
        "    broker.register_agent(calculator)\n",
        "\n",
        "    print(f\"\\n📋 REGISTERED AGENTS:\")\n",
        "    for agent_id, agent in broker.agents.items():\n",
        "        print(f\"  • {agent.name} ({agent_id}): {', '.join(agent.capabilities)}\")\n",
        "\n",
        "    print(f\"\\n🔬 SCENARIO 1: Information Query (ASK performative)\")\n",
        "    query_msg = assistant.send_query(\"agent-001\", \"What are the key factors in AI research?\")\n",
        "    broker.route_message(query_msg)\n",
        "\n",
        "    print(f\"\\n🔢 SCENARIO 2: Action Request (REQUEST-ACTION performative)\")\n",
        "    calc_request = researcher.send_request(\"agent-003\", \"calculate\", {\"expression\": \"sqrt(144) + 10\"})\n",
        "    broker.route_message(calc_request)\n",
        "\n",
        "    print(f\"\\n📢 SCENARIO 3: Information Sharing (TELL performative)\")\n",
        "    info_msg = researcher.send_inform(\"agent-002\", \"New research paper published on quantum computing\")\n",
        "    broker.route_message(info_msg)\n",
        "\n",
        "    print(f\"\\n📊 PROTOCOL STATISTICS:\")\n",
        "    print(f\"  • Total messages processed: {len(broker.message_log)}\")\n",
        "    print(f\"  • Active conversations: {len(set(msg.conversation_id for msg in broker.message_log))}\")\n",
        "    print(f\"  • Message types used: {len(set(msg.performative for msg in broker.message_log))}\")\n",
        "\n",
        "    print(f\"\\n📋 SAMPLE ACP MESSAGE FORMAT:\")\n",
        "    sample_msg = assistant.send_query(\"agent-001\", \"Sample question for format demonstration\")\n",
        "    print(sample_msg.to_acp_format())"
      ],
      "metadata": {
        "id": "bQig2tTjVPwu"
      },
      "execution_count": 10,
      "outputs": []
    },
    {
      "cell_type": "code",
      "execution_count": 2,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "id": "5o2iK_i7Tj68",
        "outputId": "6a9c9515-c2e1-4333-83fe-35c4e88c9efa"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "\n",
            "    🚀 GOOGLE COLAB SETUP GUIDE:\n",
            "    \n",
            "    1. Get Gemini API Key: https://makersuite.google.com/app/apikey\n",
            "    2. Replace: GEMINI_API_KEY = \"YOUR_ACTUAL_API_KEY\"\n",
            "    3. Run: demonstrate_acp()\n",
            "    \n",
            "    🔧 ACP PROTOCOL FEATURES:\n",
            "    \n",
            "    • Standardized message format with required fields\n",
            "    • Speech act performatives (TELL, ASK, REQUEST-ACTION, etc.)\n",
            "    • Conversation tracking and message threading\n",
            "    • Error handling and acknowledgments\n",
            "    • Message routing and delivery confirmation\n",
            "    \n",
            "    📝 EXTEND THE PROTOCOL:\n",
            "    ```python\n",
            "    # Create custom agent\n",
            "    my_agent = ACPAgent(\"my-001\", \"CustomBot\", [\"custom-capability\"])\n",
            "    broker.register_agent(my_agent)\n",
            "    \n",
            "    # Send custom message\n",
            "    msg = my_agent.send_query(\"agent-001\", \"Your question here\")\n",
            "    broker.route_message(msg)\n",
            "    ```\n",
            "    \n",
            "🤖 AGENT COMMUNICATION PROTOCOL (ACP) DEMONSTRATION\n",
            "============================================================\n",
            "✓ Registered agent: Dr. Research (agent-001)\n",
            "✓ Registered agent: AI Assistant (agent-002)\n",
            "✓ Registered agent: MathBot (agent-003)\n",
            "\n",
            "📋 REGISTERED AGENTS:\n",
            "  • Dr. Research (agent-001): analysis, research, data-processing\n",
            "  • AI Assistant (agent-002): information, scheduling, communication\n",
            "  • MathBot (agent-003): calculation, mathematics, computation\n",
            "\n",
            "🔬 SCENARIO 1: Information Query (ASK performative)\n",
            "\n",
            "📨 ACP MESSAGE ROUTING:\n",
            "From: agent-002 → To: agent-001\n",
            "Performative: ask\n",
            "Content: {\n",
            "  \"question\": \"What are the key factors in AI research?\",\n",
            "  \"query-type\": \"yes-no\"\n",
            "}\n",
            "\n",
            "📤 GENERATED RESPONSE:\n",
            "From: agent-001 → To: agent-002\n",
            "Content: {\n",
            "  \"response\": {\n",
            "    \"answer\": \"As Dr. Research, analyzing the landscape of AI research based on my capabilities of analysis, research, and data-processing, I identify the following key factors:\\n\\n**1. Algorithmic Innovation:** This involves developing novel algorithms and architectures for various AI tasks.  Key areas include:\\n\\n* **Deep Learning advancements:**  Improving existing deep learning architectures (CNNs, RNNs, Transformers) and exploring new ones to enhance performance, efficiency, and generalizability.\\n* **Reinforcement Learning breakthroughs:** Creating more robust and sample-efficient reinforcement learning algorithms for complex control tasks and decision-making problems.\\n* **Explainable AI (XAI):**  Developing methods to make AI models more transparent and understandable, boosting trust and facilitating debugging.\\n* **Hybrid approaches:** Combining different AI techniques (e.g., symbolic reasoning with deep learning) to leverage the strengths of each.\\n\\n**2. Data Availability and Quality:**  AI models are data-hungry. Key aspects include:\\n\\n* **Large-scale datasets:** Access to massive, diverse, and representative datasets is crucial for training powerful models.\\n* **Data annotation and curation:** High-quality, accurately labeled data is essential for supervised learning.\\n* **Data augmentation techniques:**  Methods to artificially increase the size and diversity of datasets.\\n* **Data privacy and security:**  Addressing ethical concerns related to data collection, usage, and protection.\\n\\n**3. Computational Resources:** Training sophisticated AI models requires significant computational power.  This involves:\\n\\n* **High-performance computing (HPC):** Access to powerful GPUs, TPUs, and specialized hardware.\\n* **Distributed computing frameworks:**  Efficiently distributing computations across multiple machines.\\n* **Energy efficiency:**  Developing more energy-efficient AI algorithms and hardware.\\n\\n**4. Theoretical Foundations:** A strong theoretical understanding is crucial for guiding the development of robust and reliable AI systems.  This includes:\\n\\n* **Understanding generalization:**  Improving our understanding of why and how AI models generalize to unseen data.\\n* **Robustness and safety:** Developing techniques to make AI systems more robust to adversarial attacks and ensure their safe deployment.\\n* **Mathematical modeling:**  Developing rigorous mathematical frameworks for analyzing and understanding AI algorithms.\\n\\n**5. Ethical and Societal Considerations:**  The development and deployment of AI must be guided by ethical principles. This includes:\\n\\n* **Bias and fairness:**  Mitigating biases in data and algorithms to ensure fairness and prevent discrimination.\\n* **Transparency and accountability:**  Developing mechanisms for understanding and explaining AI decisions.\\n* **Job displacement and economic impact:**  Addressing the potential social and economic consequences of AI automation.\\n* **Safety and security:**  Ensuring the safe and secure deployment of AI systems to prevent malicious use.\\n\\n\\nThese five factors are interconnected and crucial for advancing the field of AI research.  Progress in one area often necessitates advancements in others.  My ongoing research will continue to monitor and analyze these key drivers to provide up-to-date insights.\",\n",
            "    \"confidence\": 0.8\n",
            "  },\n",
            "  \"original-question\": {\n",
            "    \"question\": \"What are the key factors in AI research?\",\n",
            "    \"query-type\": \"yes-no\"\n",
            "  }\n",
            "}\n",
            "\n",
            "🔢 SCENARIO 2: Action Request (REQUEST-ACTION performative)\n",
            "\n",
            "📨 ACP MESSAGE ROUTING:\n",
            "From: agent-001 → To: agent-003\n",
            "Performative: request-action\n",
            "Content: {\n",
            "  \"action\": \"calculate\",\n",
            "  \"parameters\": {\n",
            "    \"expression\": \"sqrt(144) + 10\"\n",
            "  }\n",
            "}\n",
            "\n",
            "📤 GENERATED RESPONSE:\n",
            "From: agent-003 → To: agent-001\n",
            "Content: {\n",
            "  \"response\": {\n",
            "    \"status\": \"refused\",\n",
            "    \"result\": \"Cannot perform calculate - not in my capabilities\"\n",
            "  },\n",
            "  \"original-question\": {\n",
            "    \"action\": \"calculate\",\n",
            "    \"parameters\": {\n",
            "      \"expression\": \"sqrt(144) + 10\"\n",
            "    }\n",
            "  }\n",
            "}\n",
            "\n",
            "📢 SCENARIO 3: Information Sharing (TELL performative)\n",
            "\n",
            "📨 ACP MESSAGE ROUTING:\n",
            "From: agent-001 → To: agent-002\n",
            "Performative: tell\n",
            "Content: {\n",
            "  \"fact\": \"New research paper published on quantum computing\",\n",
            "  \"data\": null\n",
            "}\n",
            "[AI Assistant] Received information: New research paper published on quantum computing\n",
            "\n",
            "📤 GENERATED RESPONSE:\n",
            "From: agent-002 → To: agent-001\n",
            "Content: {\n",
            "  \"status\": \"received\",\n",
            "  \"fact\": \"New research paper published on quantum computing\"\n",
            "}\n",
            "\n",
            "📊 PROTOCOL STATISTICS:\n",
            "  • Total messages processed: 6\n",
            "  • Active conversations: 3\n",
            "  • Message types used: 5\n",
            "\n",
            "📋 SAMPLE ACP MESSAGE FORMAT:\n",
            "{\n",
            "  \"message-id\": \"d33b058c-a9e3-4a2f-9043-439c2f7aca88\",\n",
            "  \"sender\": \"agent-002\",\n",
            "  \"receiver\": \"agent-001\",\n",
            "  \"performative\": \"ask\",\n",
            "  \"content\": {\n",
            "    \"question\": \"Sample question for format demonstration\",\n",
            "    \"query-type\": \"yes-no\"\n",
            "  },\n",
            "  \"protocol\": \"ACP-1.0\",\n",
            "  \"conversation-id\": \"bf213d5e-89ab-4fa9-890a-64f9179f520e\",\n",
            "  \"reply-to\": null,\n",
            "  \"language\": \"english\",\n",
            "  \"encoding\": \"json\",\n",
            "  \"timestamp\": 1748459540.5486248\n",
            "}\n"
          ]
        }
      ],
      "source": [
        "def setup_guide():\n",
        "    print(\"\"\"\n",
        "    🚀 GOOGLE COLAB SETUP GUIDE:\n",
        "\n",
        "    1. Get Gemini API Key: https://makersuite.google.com/app/apikey\n",
        "    2. Replace: GEMINI_API_KEY = \"YOUR_ACTUAL_API_KEY\"\n",
        "    3. Run: demonstrate_acp()\n",
        "\n",
        "    🔧 ACP PROTOCOL FEATURES:\n",
        "\n",
        "    • Standardized message format with required fields\n",
        "    • Speech act performatives (TELL, ASK, REQUEST-ACTION, etc.)\n",
        "    • Conversation tracking and message threading\n",
        "    • Error handling and acknowledgments\n",
        "    • Message routing and delivery confirmation\n",
        "\n",
        "    📝 EXTEND THE PROTOCOL:\n",
        "    ```python\n",
        "    # Create custom agent\n",
        "    my_agent = ACPAgent(\"my-001\", \"CustomBot\", [\"custom-capability\"])\n",
        "    broker.register_agent(my_agent)\n",
        "\n",
        "    # Send custom message\n",
        "    msg = my_agent.send_query(\"agent-001\", \"Your question here\")\n",
        "    broker.route_message(msg)\n",
        "    ```\n",
        "    \"\"\")\n",
        "\n",
        "if __name__ == \"__main__\":\n",
        "    setup_guide()\n",
        "    demonstrate_acp()"
      ]
    }
  ]
}